/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pennychecker.swing.presenter.ext.listener;

import com.pennychecker.swing.presenter.ext.component.HandlerAdapter;
import com.pennychecker.swing.presenter.ext.event.ChangeEvent;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

/**
 *
 * @author iolaus
 */
public class DocumentListenerAdapter implements DocumentListener {

    private final HandlerAdapter handlerAdapter;

    public DocumentListenerAdapter(HandlerAdapter handlerAdapter) {
        this.handlerAdapter = handlerAdapter;
    }

    @Override
    public void insertUpdate(DocumentEvent e) {
        handlerAdapter.fireEvent(new ChangeEvent());
    }

    @Override
    public void removeUpdate(DocumentEvent e) {
        handlerAdapter.fireEvent(new ChangeEvent());
    }

    @Override
    public void changedUpdate(DocumentEvent e) {
        handlerAdapter.fireEvent(new ChangeEvent());
    }
}
